import 'package:flutter/material.dart';
import 'package:freemusic/page/songsheet/KGCloudSongSheet.dart';
import 'package:freemusic/page/songsheet/QQCloudSongSheet.dart';
import 'package:freemusic/page/songsheet/WYCloudSongSheet.dart';
import 'package:freemusic/utils/Util.dart';

/**
 * 云歌单
 */
class CloudSongSheetPage extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    return CloudSongSheetState();
  }
}

class CloudSongSheetState extends State<CloudSongSheetPage>
    with SingleTickerProviderStateMixin {
  TabController _tabController;

  Color wordColor = Util.wordColor;
  Color themeColor = Util.themeColor;

  @override
  void initState() {
    super.initState();
    _tabController = TabController(
      length: 2,
      vsync: this,
    );
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("同步歌单"),
        centerTitle: true,
        backgroundColor: themeColor,
        elevation: 1,
        bottom: TabBar(
          indicatorColor: Colors.white,
          controller: _tabController,
          tabs: <Widget>[
            MusicPlatformCard(
              platform: "QQ音乐",
            ),
            MusicPlatformCard(
              platform: "网易云",
            ),
          ],
        ),
      ),
      body: TabBarView(
        controller: _tabController,
        children: <Widget>[
          QQCloudSongSheet(),
          WYCloudSongSheet(),
        ],
      ),
    );
  }
}

class MusicPlatformCard extends StatelessWidget {
  final String platform;

  const MusicPlatformCard({Key key, this.platform}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      padding: EdgeInsets.only(top: 10, bottom: 10, left: 8, right: 8),
      child: Text("$platform"),
    );
  }
}
